function! Load_Vjde_Cp()
	if strlen(g:vjde_lib_path) == 0
		let result = ""
		let b:tmpfile = tempname()
		execute "!ls lib/ > " . b:tmpfile
		let b:lst = readfile(b:tmpfile)
		echo findfile("lib", "")
		for str in b:lst
			"if isdirectory(str)
			if strridx(str, ".jar") == strlen(str) - 4
				if strlen(result) > 0
					let result = result . ":lib/" . str
				else
					let result = "lib/" . str
				endif
			endif
		endfor
		if strlen(result) == 0
			let g:vjde_lib_path = "bin"
		else
			let g:vjde_lib_path=result . ":bin"
		endif
		execute "!rm " . b:tmpfile
	endif
endfunction

function! Init_Java_Env()
	if !exists("g:Has_Inited_Java_Env")
		let g:Has_Inited_Java_Env = 1
		let g:EclimJavaSearchSingleResult = 'edit'
		set completeopt=longest,menuone
		"call Load_Vjde_Cp()
		""let g:vjde_auto_mark = 1
		""let g:vjde_cfu_java_dot = 1
		""let g:vjde_cfu_java_para = 0
		""let java_previewer = VjdePreviewWindow_New()
		""let java_previewer.name = 'java_previewer'
		""let java_previewer.onSelect='VjdeInsertWord'
		""let java_previewer.previewLinesFun='GetJavaCompletionLines'
		""let java_previewer.docLineFun='VjdeGetDocWindowLine'
		"let g:vjde_show_paras = 1
		"let g:vjde_out_path = "bin"
		"let g:vjde_src_path = "src"
		"nnoremap <silent> <leader>ac :Vjdec<cr>
		"nnoremap <silent> <leader>ar :Vjder<cr>
	endif

	nnoremap <silent> <buffer> <leader>i :JavaImport<cr>
	nnoremap <silent> <buffer> <leader>d :JavaDocSearch -x declarations<cr>
	nnoremap <silent> <buffer> <cr> :JavaSearchContext<cr>
	inoremap <buffer> . .<C-x><C-u>
	"au BufWritePost <buffer> Vjdec
endfunction

function! Init_Cpp_Env()
	"if !exists("g:Has_Inited_Cpp_Env")
	"let g:Has_Inited_Cpp_Env = 1
	"au!
	"au BufWritePost <buffer> execute "!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q ."
	"endif
endfunction 
